package com.hdx.server.controller.user;


import com.hdx.common.result.Result;
import com.hdx.model.entity.Category;
import com.hdx.server.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Api(tags = "C端-分类接口")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    //根据类型查询分类
    @GetMapping("/list")
    @ApiOperation("查询分类")
    public Result<List<Category>> getCategorylist(Integer type) {
        List<Category> list=categoryService.getCategoryByType(type);
        return Result.success(list);


    }
}
